#!/bin/bash
#    am-help-pipemenu - an Openbox pipemenu for displaying help files
#    Copyright (C) 2015 damo    <damo@bunsenlabs.org>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


HELP='    am-help-pipemenu an Openbox Pipe Menu for displaying help files
    It should normally be called from an openbox menu.

Options (usually passed from the menu):
    -h --help   show this message

    If am-help-pipemenu is called with no options (the usual method),
    it will output an xml openbox pipemenu displaying various help files,
    both online and on the system.
'
# look for a help option somewhere
for i in "$@"
do
    case "$i" in
    -h|--help)
        echo "$HELP"
        exit 0
        ;;
    esac
done

AL_COMMON_LIBDIR='/usr/lib/arcolinux/common'

if ! . "$AL_COMMON_LIBDIR/am-include.cfg" 2> /dev/null; then
    echo $"Error: Failed to source am-include.cfg in $AL_COMMON_LIBDIR" >&2
    exit 1
fi

menuStart
menuSeparator 'Linux Help'
menuSeparator

menuSubmenu 'OpenboxWWW' 'Openbox'
menuSubmenu 'ObWWW' 'Openbox Website'
menuItem 'Openbox Homepage' 'exo-open "http://openbox.org/"'
menuItem 'Openbox Getting Started' 'exo-open "http://openbox.org/wiki/Help:Getting_started"'
menuItem 'Openbox Documentation' 'exo-open "http://openbox.org/wiki/Help:Contents"'
menuItem 'Openbox FAQs' 'exo-open "http://openbox.org/wiki/Help:FAQ"'
menuSubmenuEnd
menuItem 'Arch Wiki Openbox Guide' 'exo-open "http://wiki.archlinux.org/index.php/Openbox"'
menuItem 'Debian Wiki Openbox Guide' 'exo-open "https://wiki.debian.org/Openbox"'
menuItem 'Urukramas Openbox Guide' 'exo-open "https://urukrama.wordpress.com/openbox-faq/"'
menuSubmenuEnd

menuSubmenu 'Tint2WWW' 'Tint2'
menuItem 'Tint2 Wiki: FAQ' 'exo-open "https://gitlab.com/o9000/tint2/wikis/FAQ"'
menuItem 'Tint2 Wiki: Configuration' 'exo-open "https://gitlab.com/o9000/tint2/blob/master/doc/tint2.md"'
menuSubmenuEnd

menuSubmenu 'ConkyWWW' 'Conky'
menuItem 'Conky Wiki' 'exo-open "https://github.com/brndnmtthws/conky/wiki"'
menuItem 'Conky Variables' 'exo-open "http://conky.sourceforge.net/variables.html"'
menuItem 'Conky Configuration' 'exo-open "http://conky.sourceforge.net/config_settings.html"'
menuSubmenuEnd

menuSubmenu 'ThemesWWW' 'Theme Resources'
menuItem 'Box-Look.org' 'exo-open "http://www.box-look.org"'
menuItem 'Gnome-Look.org' 'exo-open "http://gnome-look.org/"'
menuSubmenuEnd

menuSeparator 'Wikis'
menuItem 'Arch Wiki' 'exo-open "https://wiki.archlinux.org"'
menuItem 'Termite' 'exo-open "https://wiki.archlinux.org/index.php/termite"'
menuItem 'Neofetch' 'exo-open "https://github.com/dylanaraps/neofetch"'

menuEnd
